home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group99a.txt
/
000071_icon-group-sender _Wed Mar 31 09:26:05 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
5KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id JAA09302
for icon-group-addresses; Wed, 31 Mar 1999 09:25:57 -0700 (MST)
Message-Id: <199903311625.JAA09302@baskerville.CS.Arizona.EDU>
Date: Tue, 30 Mar 1999 17:28:55 -0600
From: Steve Graham <graham@cowboy.biomed.com>
X-Accept-Language: en
To: Alan Saichek <abs@reba.engr.sgi.com>,
Icon Mailing List <icon-group@optima.CS.Arizona.EDU>
Subject: Re: [Fwd: Problem reading binary file]
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Alan,
I tried it and that did the trick. Thanks a lot.
Steve Graham
===
Alan Saichek wrote:
>
>
> Hi Steve,
>
> I haven't tried this, but on the surface...
>
> Ctrl-Z is end-of-file in DOS.
>
> Check out Chap 11 Input and Output (2nd edition)
> Text Files and Binary Files
>
> which mentions translated mode. Use "u" qualifier for
> untranslated mode.
>
> > > in := open(args[1],"ru") | stop("Unable to open ",args[1])
> > > out := open(args[2],"wu") | stop("Unable to open ",args[2])
>
> Regards, Alan
>
> >
> > Hello again.
> >
> > Turns out that the problem with this was that the 7th character was an
> > ASCII 26 (^Z) and Icon would not read any further than that. I created
> > a 2nd file with a ^Z in a different position and got a similar result.
> > This is despite the fact that there were over 25,000 characters
> > following the Control Z.
> >
> > So, my question is: Why does Icon stop reading when it hits a ^Z? I
> > can kind of understand this if I were reading a text file; but I was
> > specifically using reads() because this is a binary file? Should not
> > reads() support all 256 ASCII codes and only stop reading when there are
> > REALLY no more characters to read? I ended up using another language,
> > which was significantly harder for me, to read the binary characters.
> >
> > In Icon's defense, I notice that when I TYPE the above-mentioned 2nd
> > file, I only see the characters occurring prior to the ^Z. And I do not
> > want it to appear that I am questioning Icon's usefulness. It is
> > normally one of the 1st languages I choose for utilities of this type.
> >
> > Comments?
> >
> >
> > Steve Graham
> >
> > ===
> >
> > Steve Graham wrote:
> > >
> > > Hello.
> > >
> > > I am using MS-DOS Icon 9.1 to read a binary file. After reading 6
> > > characters, the program apparently quits reading. I have attached the
> > > relevant portion of the code:
> > >
> > > -------------------------- Code ------------------------------
> > > procedure main(args)
> > > #
> > > cnt := 0
> > > in := open(args[1],"r") | stop("Unable to open ",args[1])
> > > out := open(args[2],"w") | stop("Unable to open ",args[2])
> > > while character := reads(in,1) do {
> > > write(character," -->", ord(character))
> > > cnt := cnt+1
> > > }
> > > close(in,out)
> > > write(cnt," characters transferred")
> > > end
> > > -----------------------End of Code-------------------------
> > >
> > > I invoke the program with:
> > >
> > > word r99-0059.doc r99-0059.txt
> > >
> > > I get output of (some unprintable characters are represent by _):
> > >
> > > - -->208
> > > - -->207
> > > -->17
> > > _ -->224
> > > � -->161
> > > _ -->177
> > > 6 characters transferred
> > >
> > > Any ideas?
> > >
> > > Thanks in advance.
> > >
> > > -- Steve
> > >
> > > ______________________________________________________
> > >
> > > Steve Graham
> > > Laboratory Corporation of America (LabCorp)
> > > 12160 Abrams Road, Suite 601
> > > Dallas, Texas 75243
> > >
> > > E-mail: graham@cowboy.biomed.com
> > > Phone: 972.643.6124 (direct to desk)
> > > 972.437.5255 ext 5224
> > > FAX: 972.454.1040
> > > _______________________________________________________
> >
>
> --
> Alan B. Saichek abs@engr.sgi.com
> Member Technical Staff - QA Team Lead (650) 933-2507
> Advanced Entertainment Systems, Video Compute R&D 07L-808
--
______________________________________________________
Steve Graham
Laboratory Corporation of America (LabCorp)
12160 Abrams Road, Suite 601
Dallas, Texas 75243
E-mail: graham@cowboy.biomed.com
Phone: 972.643.6124 (direct to desk)
972.437.5255 ext 5224
FAX: 972.454.1040
_______________________________________________________